<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=request.getSession().getAttribute("title")%></title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/css/menu2.css"/>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/css/style.css"/> 
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/css/demo_table_jui.css"/> 
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/css/blitzer/jquery-ui-1.8.5.custom.css"/> 	
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/css/jquery.autocomplete.css"/> 	
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/css/border-radius.css" />
<!-- JS -->
<script type="text/javascript"  src="<%= request.getContextPath()%>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript"  src="<%= request.getContextPath()%>/js/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jquery.url.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jquery.validate.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jquery.blockUI.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jquery.autocomplete.min.js"></script> 
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/date.js"></script> 
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jquery.cookie.js"></script>
<script type="text/javascript"  language="javascript" src="<%= request.getContextPath()%>/js/jquery.layout.min.js"></script>
<!--<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/autoresize.jquery.min.js"></script>  -->
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/globalization/en-GB.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jscal2.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/lang/en.js"></script>
<script type="text/javascript" language="javascript" src="<%= request.getContextPath()%>/js/jquery.floatingmessage.js"></script>
<script type="text/javascript">
    function IncludeJavaScript(jsFile){
        document.write('<script type="text/javascript" src="'+ jsFile + '"></scr' + 'ipt>');
    }
</script>
<%if (request.getSession().getAttribute("org.apache.struts.action.LOCALE").toString().equals("sr")) {%>
<script type="text/javascript">
    //var lang = "<%=request.getSession().getAttribute("org.apache.struts.action.LOCALE")%>";
    //alert("jezik sr= "+lang);
    IncludeJavaScript('<%= request.getContextPath()%>/js/localization/messages_sr.js');
</script>
<%}%>

<%if (request.getSession().getAttribute("org.apache.struts.action.LOCALE").toString().equals("sr_cr")) {%>
<script type="text/javascript">
    //var lang = "<%=request.getSession().getAttribute("org.apache.struts.action.LOCALE")%>";
    //alert("jezik sr= "+lang);
    IncludeJavaScript('<%= request.getContextPath()%>/js/localization/messages_sr_cr.js');
</script>
<%}%>
<script type="text/javascript">
    var layout;
    var hideWest='false';
    var hideNorth='false';
    var hideSouth='false';
	var editing = false;
        <%if(request.getSession().getAttribute("org.apache.struts.action.LOCALE").toString().equals("sr")){%>
	var path2SrLocaleTables = "<%= request.getContextPath()%>/js/localization/sr.txt";
        <%}%>
	<%if(request.getSession().getAttribute("org.apache.struts.action.LOCALE").toString().equals("sr_cr")){%>
	var path2SrLocaleTables = "<%= request.getContextPath()%>/js/localization/sr_cr.txt";
        <%}%>
        var formChanged= false;
</script>
<script type="text/javascript">

var readOnly="<%=(String)session.getAttribute("readOnly")%>";
	if(readOnly=="false"){
		editing = true;
	}
	else{
		editing = false;
	}

$(function(){
	$('.dialog').dialog({
						autoOpen: false,
						width: 1000,                                           
						modal: true,
						closeOnEscape: true,
						beforeClose: function(event, ui) { 
							if(editing && formChanged){
								var answer = confirm('Are you sure you want close without saving?\nDa li ste sigurni da želite da zatvorite prozor bez snimanja?');
								formChanged = !answer;
								return answer;
							}
						}						});
			});
			
			
			function postHtml(path,regionDest,regionSource){
				$.post(path, function(data) {
					var message= $(data).find(regionSource);
					$('regionDest').append(message);
				});
			}

			
function getHtmlAjax(path,regionDest,regionSource){
$.ajax({
   cache: false,
   type: "GET",
   url: path,
   beforeSend: function(){
     //$('#waitDialog').dialog('open');
	 // Handle the beforeSend event
   },
   success: function(msg){
     //$('#waitDialog').dialog('close');
     var forma =$(msg).find(regionSource).html();
     //alert(forma);
	 var forma = $(regionDest).html(forma);
	 forma.find(':input').each(function (i) {
          $(this).data('initial_value', $(this).val());
     });
	 
	 forma.find(':input').keyup(function() {
          if ($(this).val() != $(this).data('initial_value')) {
               //handleFormChanged();
          }
     });
	if(!editing){
			//$('#searchParticipants').remove();
			//$(regionDest+' :input').attr('disabled', true);		
			$(regionDest+" input[type='submit']").addClass('hidden');
			$(".hideInViewDialog").remove();	
		}
	$(".hideInDialog").remove();
	$(regionDest +" .form").validate();
		
	if($(regionDest).hasClass('dialog')){
		$(regionDest).dialog('open');
	 
	}
	
   },
    error:function (xhr, ajaxOptions, thrownError){
                    
		$('#waitDialog').dialog('close');
		alert(xhr.status);
                    alert(thrownError);
                }    
 });
}

</script>